// 所有自身業務服務的封裝
import req from './axios'
import {paths} from '../config'

let _router = '';

export const userLogin = async (data) => {
    return req.post(`${_router}${paths.business._userLogin}`, data)
}
export const menuList = async () => {
    return req.get(`${_router}${paths.business._menulist}`)
}
export const getAllMenuTreeList = async () => {
    return req.get(`${_router}${paths.business._getAllTreeList}`)
}
export const selectAllMenu = async () => {
    return req.get(`${_router}${paths.business._selectAllMenu}`)
}
export const updateMenuState = async (data) => {
    return req.get(`${_router}${paths.business._updateMenuState}` + "/" + data)
}
export const delOneMenu = async (data) => {
    return req.get(`${_router}${paths.business._delOneMenu}` + "/" + data)
}
export const addMenu = async (data) => {
    return req.post(`${_router}${paths.business._addMenu}`, data)
}
export const addDevice = async (data) => {
    return req.post(`${_router}${paths.business._addDevice}`, data)
}
export const getAllDeviceTree = async () => {
    return req.get(`${_router}${paths.business._getAllDeviceTree}`)
}
export const delOneDevice = async (data) => {
    return req.get(`${_router}${paths.business._delOneDevice}` + "/" + data)
}
export const getAllDeviceType = async () => {
    return req.get(`${_router}${paths.business._getAllDeviceType}`)
}
export const getDeviceTypePaging = async (data) => {
    return req.post(`${_router}${paths.business._getDeviceTypePaging}`, data)
}
export const delDeviceTypeByGuid = async (data) => {
    return req.get(`${_router}${paths.business._delDeviceTypeByGuid}` + "/" + data)
}
export const addDeviceType = async (data) => {
    return req.post(`${_router}${paths.business._addDeviceType}`, data)
}
export const getAllDictTree = async () => {
    return req.get(`${_router}${paths.business._getAllDictTree}`)
}
export const selectAllDict = async () => {
    return req.get(`${_router}${paths.business._selectAllDict}`)
}
export const delOneDataDict = async (data) => {
    return req.get(`${_router}${paths.business._delDatadict}` + "/" + data)
}
export const addDataDict = async (data) => {
    return req.post(`${_router}${paths.business._addDatadict}`, data)
}
export const getUsers = async (data) => {
    return req.post(`${_router}${paths.business._getUsers}`, data)
}
export const addUser = async (data) => {
    return req.post(`${_router}${paths.business._addUser}`, data)
}
export const delOneUser = async (data) => {
    return req.get(`${_router}${paths.business._delOneUser}`+ "/" + data)
}
export const getRoles = async (data) => {
    return req.post(`${_router}${paths.business._getRoles}`, data)
}


export default {
    userLogin,
    menuList,
    getAllMenuTreeList,
    selectAllMenu,
    delOneMenu,
    addMenu,
    updateMenuState,
    addDevice,
    getAllDeviceTree,
    delOneDevice,
    getAllDeviceType,
    getDeviceTypePaging,
    delDeviceTypeByGuid,
    getAllDictTree,
    selectAllDict,
    delOneDataDict,
    addDataDict,
    getRoles
}
